<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: LQ
  Date: 2021/5/19
  Time: 19:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript" src="/jQuery/jquery-3.4.1.min.js"></script>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="/css/publish.css">
</head>
<body>

<div>
    <jsp:include page="main.jsp"/>
</div>

<form action="/updateArticle?aId=${requestScope.article.articleId}" method="post" class="content_div">
    <input id="inputArticleName" type="text" name="articleName" placeholder="输入文章标题">
    <input id="inputArticleTag" type="text" name="articleTag" placeholder="输入文章标签">

    <select name="category">
        <c:forEach items="${requestScope.categoryList}" var="category">
            <option value="${category.categoryId}">${category.categoryName}</option>
        </c:forEach>
    </select>

    <br>
    <textarea id="textarea" rows="20" cols="61" name="articleContent" placeholder="输入文章内容"></textarea>
    <br>
    <label>
        <input type="checkbox" name="canComment" value="1">禁止评论
    </label>
    <label>
        <input type="checkbox" name="canPing" value="1">禁止Ping
    </label>
    <label>
        <input type="checkbox" name="canSubscribe" value="1">禁止订阅
    </label>
    <label>
        <input type="checkbox" name="isDraft" value="1">存为草稿
    </label>
    <button type="submit">保存</button>
</form>
</body>

<script>

    $("#show_div").load("/main.jsp")

    let  inputArticleName = document.getElementById("inputArticleName")
    let  inputArticleTag = document.getElementById("inputArticleTag")
    let textarea = document.getElementById("textarea")

    inputArticleName.value = "${requestScope.article.articleName}"
    inputArticleTag.value = "${requestScope.article.articleTag}"
    textarea.value = "${requestScope.article.articleContent}"
</script>

</html>
